package edu.nus.mtech.sem1.ca.cust;




/**
 * Stores customer and customer related information
 *
 */
public class Customer {
	
	//nric will be Customer's Id field
	private String nric;
	private String name;
	private String address; //lets assume that there is only one address per client
	private String email;
	private String interests;
	private String accountNo;
	private Status status;
	
	public Customer(){
		nric="";
		name="";
		address="";
		email="";
		interests="";
		accountNo="";
		status=Status.ACTIVE;
	}
	
	public String generateStatement() {
	
		return null;
	}

	public String getNric() {
		return nric;
	}

	public void setNric(String nric) {
		this.nric = nric;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public String getInterests() {
		return interests;
	}

	public void setInterests(String interests) {
		this.interests = interests;
	}

	public Status getStatus() {
		return status;
	}

	public void setStatus(Status status) {
		this.status = status;
	}

	public String getAccountNo() {
		return accountNo;
	}

	public void setAccountNo(String accountNo) {
		this.accountNo = accountNo;
	}

	public String getAddress() {
		return address;
	}

	public void setAddress(String address) {
		this.address = address;
	}

	@Override
	public boolean equals(Object customerObj) {
		boolean allResult=false;
		
		if (customerObj!=null && customerObj instanceof Customer){
			Customer incomingCustomer=(Customer)customerObj;
			
			if (incomingCustomer.getNric().equals(nric)){
				allResult=true;
			}
			if (incomingCustomer.getName().equals(name)){
				allResult=allResult && true;
			}
			if (incomingCustomer.getAddress().equals(address)){
				allResult=allResult && true;
			}
			if (incomingCustomer.getEmail().equals(email)){
				allResult=allResult && true;
			}
			if (incomingCustomer.getInterests().equals(interests)){
				allResult=allResult && true;
			}
			if (incomingCustomer.getAccountNo().equals(accountNo)){
				allResult=allResult && true;
			}
			if (incomingCustomer.getStatus().equals(status)){
				allResult=allResult && true;
			}
			
		}
		return allResult;
	}
	
	@Override
	public String toString() {
		return(nric+"::"+name+"::"+address+"::"+email+"::"+interests+"::"+accountNo+"::"+status.toString());
	}
	
	@Override
	public int hashCode() {
		int hashCode=(nric.hashCode()*73)+name.hashCode()+address.hashCode()+email.hashCode()+interests.hashCode()+accountNo.hashCode()+status.hashCode();
		return hashCode;
	}
	
}
